package com.xin.jdbc_02;

import com.xin.jdbc_utils.DBUtil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class psjdbcdemo_01 {
    public static void main(String[] args) {
        Connection conn=null;
        PreparedStatement ps =null;
        try {
            conn=DBUtil.getConnection();
            ps=conn.prepareStatement("update ib set balance=? where id=?");
            ps.setInt(1,50);
            ps.setInt(2,1);
            ps.executeUpdate();
//            conn.commit();

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(ps!=null){
                try {
                    ps.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }if(conn!=null){
                try {
                    ps.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
